package cc.tuhaolicai.mt.user.mobile.business.model;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

import java.util.Date;

/**
 * 业务流用节点
 */
public class Node implements java.io.Serializable {

    /**
     * 业务名称
     */
    private String nodeName;

    /**
     * 当前业务状态
     * 0：表示开始
     * 1：表示成功
     * 2：表示失败
     */
    private Integer status;

    /**
     * 当前业务属于该业务链的第几步
     */
    private Integer sort;

    /**
     * 所属业务的订单号
     */
    private String orderNo;

    /**
     * 当前业务执行前参数
     */
    private String startParams;

    /**
     * 当前业务执行后或异常后参数保留
     */
    private String stopParams;

    /**
     * 执行结果说明
     */
    private String result;

    /**
     * 业务调用包名加类名
     */
    private String handlerClassName;

    /**
     * 添加时间
     */
    private Date addTime;

    public String getNodeName() {
        return nodeName;
    }

    public Node setNodeName(String nodeName) {
        this.nodeName = nodeName;
        return this;
    }

    public Integer getStatus() {
        return status;
    }

    public Node setStatus(Integer status) {
        this.status = status;
        return this;
    }

    public Integer getSort() {
        return sort;
    }

    public Node setSort(Integer sort) {
        this.sort = sort;
        return this;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public Node setOrderNo(String orderNo) {
        this.orderNo = orderNo;
        return this;
    }

    public String getStartParams() {
        return startParams;
    }

    public Node setStartParams(String startParams) {
        this.startParams = startParams;
        return this;
    }

    public String getStopParams() {
        return stopParams;
    }

    public Node setStopParams(String stopParams) {
        this.stopParams = stopParams;
        return this;
    }

    public String getResult() {
        return result;
    }

    public Node setResult(String result) {
        this.result = result;
        return this;
    }

    public Date getAddTime() {
        return addTime;
    }

    public Node setAddTime(Date addTime) {
        this.addTime = addTime;
        return this;
    }

    public String getHandlerClassName() {
        return handlerClassName;
    }

    public Node setHandlerClassName(String handlerClassName) {
        this.handlerClassName = handlerClassName;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Node node = (Node) o;
        return Objects.equal(nodeName, node.nodeName) &&
                Objects.equal(status, node.status) &&
                Objects.equal(sort, node.sort) &&
                Objects.equal(orderNo, node.orderNo) &&
                Objects.equal(startParams, node.startParams) &&
                Objects.equal(stopParams, node.stopParams) &&
                Objects.equal(result, node.result) &&
                Objects.equal(handlerClassName, node.handlerClassName) &&
                Objects.equal(addTime, node.addTime);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(nodeName, status, sort, orderNo, startParams, stopParams, result, handlerClassName, addTime);
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("nodeName", nodeName)
                .add("status", status)
                .add("sort", sort)
                .add("orderNo", orderNo)
                .add("startParams", startParams)
                .add("stopParams", stopParams)
                .add("result", result)
                .add("handlerClassName", handlerClassName)
                .add("addTime", addTime)
                .toString();
    }
}
